<?php

class UploadComponent extends Object {

//	var $layout = 'ajax';

	var $enabled = true;
//	var $components = array('RequestHandler');
	var $handles = array();

  function enregistrerFichier($nomFic, $nomFicTemp, $idSauve, $nomFicNew)
  {
    if (is_uploaded_file($nomFicTemp))
	{
	  $ext = strrchr($nomFic, '.');
	  $newFile = "../webroot/files/". $nomFicNew . $idSauve . $ext;
	  if (file_exists($newFile))
	    unlink($newFile);
	  rename($nomFicTemp, $newFile);
    }
  }
}


?>


